Permalink
Browse files

fix sanitizer exception on null string

  • Loading branch information...
1 parent 3ad5133 commit 30860ab066d65c64b7835ab1c2b6d5e6f91b227f @aliasaria committed Mar 12, 2011
Showing with 19 additions and 13 deletions.
  1. +7 −8 client/script.js
  2. 0 forever.sh
  3. +12 −5 server.js
View
@@ -1,7 +1,7 @@
var cards = {};
var totalcolumns = 0;
var columns = [];
-var currentStyle = "bigcards";
+var currentTheme = "bigcards";
var socket = new io.Socket( );
@@ -448,6 +448,7 @@ function initColumns( columnArray )
function changeThemeTo( theme )
{
+ currentTheme = theme;
$("link[title=cardsize]").attr("href", "/css/" + theme + ".css");
}
@@ -556,23 +557,21 @@ $(function() {
// Style changer
$("#smallify").click(function(){
- if (currentStyle == "bigcards")
+ if (currentTheme == "bigcards")
{
- currentStyle = "smallcards";
changeThemeTo('smallcards');
}
- else if (currentStyle == "smallcards")
+ else if (currentTheme == "smallcards")
{
- currentStyle = "bigcards";
changeThemeTo('bigcards');
}
- /*else if (currentStyle == "nocards")
+ /*else if (currentTheme == "nocards")
{
- currentStyle = "bigcards";
+ currentTheme = "bigcards";
$("link[title=cardsize]").attr("href", "css/bigcards.css");
}*/
- sendAction('changeTheme', currentStyle);
+ sendAction('changeTheme', currentTheme);
return false;
View
0 forever.sh 100644 → 100755
No changes.
View
@@ -106,14 +106,21 @@ socket.on('connection', function(client){
//santizes text
function scrub( text ) {
+ if (typeof text != "undefined" && text !== null)
+ {
+
+ //clip the string if it is too long
+ if (text.length > 65535)
+ {
+ text = text.substr(0,65535);
+ }
- //clip the string if it is too long
- if (text.length > 65535)
+ return sanitizer.sanitize(text);
+ }
+ else
{
- text = text.substr(0,65535);
+ return null;
}
-
- return sanitizer.sanitize(text);
}

0 comments on commit 30860ab

Please sign in to comment.